﻿<%@ Page Title="Unused Translations &raquo; ResourceBlender" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UnusedTranslations.aspx.cs" Inherits="UnusedTranslations" EnableEventValidation="false" %>

<asp:Content ID="cntHead" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="cntMain" ContentPlaceHolderID="cntMain" Runat="Server">
<asp:ScriptManager ID="scrUpdateLanguages" runat="server"></asp:ScriptManager>
    <h1><asp:Label ID="lblUnusedHeading" runat="server" Text="Unused Translations"></asp:Label></h1>
    <div class="breadcrumbs">
        <asp:HyperLink ID="lnkNavHome" runat="server" NavigateUrl="~/Default.aspx">ResourceBlender</asp:HyperLink> &gt; <asp:HyperLink ID="lnkNavTranslations" runat="server" NavigateUrl="~/Translations.aspx">Translations</asp:HyperLink> &gt; Unused Translations
    </div>
    <asp:MultiView ID="mltMain" runat="server" ActiveViewIndex="0">
        <asp:View ID="viwFindUnusedForm" runat="server">
            <asp:SqlDataSource ID="dsTranslations" runat="server"
                 ConnectionString="<%$ ConnectionStrings:Default %>"
                 ProviderName="<%$ ConnectionStrings:Default.ProviderName %>"
                 OnSelected="dsTranslations_Selected">
            </asp:SqlDataSource>
            <div class="niceform">
                <fieldset>
                    <legend>Find Unused Translations</legend>
                    <div class="formrow block">
                        <asp:UpdatePanel ID="updRadLanguage" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="formrow block">
                                    <label class="block">Language</label>
                                    <asp:RadioButtonList ID="radLanguage" runat="server" RepeatLayout="Flow" 
                                        OnSelectedIndexChanged="SelectLanguage"
                                        AppendDataBoundItems="true"
                                        AutoPostBack="True" CssClass="checks applicationChecks plain" RepeatColumns="3">
                                        <asp:ListItem Text="All languages" Value="all"></asp:ListItem>
                                    </asp:RadioButtonList>
                                </div>
                                <asp:UpdateProgress ID="prgRadLanguage" runat="server" 
                                    AssociatedUpdatePanelID="updRadLanguage" 
                                    DisplayAfter="100">
                                    <ProgressTemplate>
                                        <div class="centered"><asp:Image ID="imgLoadingLanguagesSelection" runat="server" ImageUrl="~/images/ajax-loader.gif" AlternateText="Finding Unused Translations..." /></div>
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                                <h3><asp:Label ID="lblNumUnused" runat="server" Text="Unused Translations"></asp:Label></h3>
                                <asp:GridView ID="grdFindUnused" runat="server" AllowPaging="True" 
                                    AllowSorting="True" AutoGenerateColumns="false" CssClass="nicetable" 
                                    Width="100%" DataSourceID="dsTranslations" 
                                    OnRowCommand="grdFindUnused_RowCommand" 
                                    OnPageIndexChanging="grdFindUnused_PageIndexChanging"
                                    OnSorting="grdFindUnused_Sorting"                                    
                                    PageSize="25">
                                    <PagerSettings PageButtonCount="8" Mode="NumericFirstLast" Position="TopAndBottom" />
                                    <Columns>
                                        <asp:TemplateField SortExpression="translation" HeaderText="Translation" ItemStyle-Width="80%">
                                            <ItemTemplate>
                                                <asp:Label ID="lblTranslation" runat="server" Text='<%# Eval("translation") %>' EnableViewState="False"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField SortExpression="number" HeaderText="Languages" ItemStyle-CssClass="centered">
                                            <ItemTemplate>
                                                <asp:Label ID="lblNumLanguages" runat="server" Text='<%# Eval("number") %>' EnableViewState="False"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Delete" ItemStyle-CssClass="doubleButton">
                                            <ItemTemplate>
                                                <asp:UpdatePanel ID="updDeleteTranslation" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:CheckBox ID="chkSelect" runat="server" />
                                                        <asp:ImageButton ID="btnDelete" runat="server" 
                                                            AlternateText='<%# "Delete translation #" + Eval("translationid") %>'
                                                            ToolTip='<%# "Delete translation #" +Eval("translationid") %>'
                                                            CommandName="deletetranslation"
                                                            CommandArgument='<%# Eval("translationid") %>'
                                                            ImageUrl="~/images/delete_10.png" />
                                                    </ContentTemplate>
                                                    <Triggers>
                                                        <asp:PostBackTrigger ControlID="btnDelete" />
                                                    </Triggers>
                                                </asp:UpdatePanel>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle CssClass="excelHead" />
                                    <AlternatingRowStyle CssClass="alt" />
                                </asp:GridView>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="radLanguage"
                                    EventName="SelectedIndexChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </div>
                </fieldset>
                <div class="actions">
                    <asp:Button ID="btnDeleteSelected" runat="server"
                        CssClass="uniformbutton" EnableViewState="False" Text="Delete Selected" 
                        OnClick="btnDeleteSelected_Click" />
                </div>
            </div>
        </asp:View>
        <asp:View ID="pnlDeleteTranslation" runat="server">
            <div class="niceform confirmation">
                <h1><asp:Label ID="lblConfirmDeletionHeading" runat="server" Text="Confirm Deletion" 
                        EnableViewState="False"></asp:Label></h1>
                <p><asp:Literal ID="litConfirmDelete" runat="server"></asp:Literal></p>
                <asp:Button ID="btnOk" runat="server" CommandName="confirmdelete" 
                    CssClass="uniformbutton" EnableViewState="False" onclick="btnOk_Click" 
                    Text="Delete Translation" />
                <asp:Button ID="btnCancelDelete" runat="server" CommandName="canceldelete" 
                    CssClass="uniformbutton" EnableViewState="False" Text="Cancel" 
                    OnClick="btnCancelDelete_Click" />
            </div>
        </asp:View>
    </asp:MultiView>
</asp:Content>

